<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
    <meta name="author" content="">
    <title></title>  <link rel="icon" href="/template/pc1/images/wmh_favicon.ico" type="image/x-icon" />
    <% include("../inc/list_css.html"){}%>
</head>
<body>
<div class="ibox ">
    <div class="ibox-title">
        <div class="pull-left mbx navbar_title">
            <span>财务管理 </span>
            <span class="line">/</span>
            提现管理
        </div>
    </div>

    <div class="ibox-content">
        <div class="wrapper wrapper-content">
            <div class="row">
                <div class="col-md-12">
                    <div class="alert alert-warning alert-dismissable">
                        <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
                        此列表是提现列表,如果银行卡信息为空，可能是用户把银行卡信息删除了
                    </div>

                    <!--<div class="btn-group margin-vertical-20_10">
                        <button class="hive-btn-md-large hive-btn-primary" id="export">
                            导出
                        </button>
                    </div>-->
                    <table data-toggle="table " id="table" data-show-export="true" class=" table-striped table-no-bordered fixed-table-container table-row-border-color table-hovered table-hover">
                        <thead class="table-header">
                        <tr>
                            <th data-field="realName">真实姓名</th>
                            <th data-field="phone">手机号码</th>
                            <th data-field="name">开户姓名</th>
                            <th data-field="cardNumber">银行卡号</th>
                            <th data-field="cardCount">开户行名称</th>
                            <th data-field="cardAddress">开户行地址</th>
                            <th data-field="aliPayAccount">支付宝账号</th>
                            <th data-field="addMoney">提现金额</th>
                            <th data-field="cashingStatus" data-formatter="cashingStatusFormatter">提现状态</th>
                            <th data-field="createDate">申请日期</th>
                            <th data-field="head" data-formatter="opFormatter" data-halign="center"  data-align="center">操作</th>
                        </tr>
                        </thead>
                    </table>

                </div>
            </div>
        </div>
    </div>
</div>


<% include("../inc/list_js.html"){}%>
<script>

    function opFormatter(value, row, index){
        var html = '<a href="javascript:void(0)" onclick="process(\''+row.id+'\',\''+row.cashAmount+'\',1);" >审核通过<i class="fa fa-check" data-toggle="tooltip" data-placement="top" title="审核通过"></i></a>';
        html += '<a href="javascript:void(0)" onclick="process(\''+row.id+'\',\''+row.cashAmount+'\',0);" ><span style="margin-left:10px;">审核不通过<i class="fa fa-close" data-toggle="tooltip" data-placement="top" title="审核不通过"></i></span></a>';
        return html;
    }


    function cashingStatusFormatter(v) {
        if(v==0){
            return '<span style="color: #0BB20C">提现成功</span>';
        }else if(v==1){
            return '<span style="color: #0a8ddf">待审核</span>';
        }else if(v==2){
            return '<span style="color: #ff0000">已拒绝</span>';
        }
    }
    function process(id,cashAmount,type) {
        if(type == 0){
            parent.layer.prompt({title: '请输入拒绝原因', formType: 2}, function(text, index){
                $.ajax({
                    url: "process",
                    type: 'POST',
                    data:{
                        "id":id,
                        "cashAmount":cashAmount,
                        "type":type,
                        "reason":text
                    },

                    success: function(data){
                        if(data.info == 'ok'){
                            layer.msg('操作成功');
                            parent.layer.closeAll();
                            $('#table').bootstrapTable("refresh");
                        }else{
                            parent.layer.closeAll();
                            parent.layer.msg(data.msg);
                        }


                    }});
            });
        }else if(type == 1){
            parent.layer.confirm('确定审核通过吗？审核成功后用户提状态将变为提现成功!', {
                btn: ['是','否'] //按钮
            }, function(){
                $.ajax({
                    url: "process",
                    type: 'GET',
                    data:{
                        "id":id,
                        "cashAmount":cashAmount,
                        "type":type
                    },
                    success: function(data){
                        if(data.info == 'ok'){
                            $('#cpTableEvents').bootstrapTable("refresh");
                            parent.layer.msg('操作成功');
                        }else{
                            parent.layer.msg(data.msg);
                        }

                    }});
            });
        }
    }
    /**
     * 加载页面数据
     * */
    (function () {

        $('#table').bootstrapTable({
            url: "ajaxlist?status=0",
            dataType: 'json',
            contentType: 'application/json',
            search: true,
            searchAlign: 'right',
            pagination: true,
            showRefresh: true,
            pageSize: 20,
            showToggle: false,//是否显示card/table切换按钮
            showColumns: true,//是否显示内容列下拉框
            pageList: [20, 50, 100],
            iconSize: 'outline',
            toolbar: '#eventsToolbar',
            paginationHAlign: 'right', //right, left
            paginationVAlign: 'bottom',
            icons: {
                refresh: 'icon-refresh',
                toggle: 'glyphicon-list-alt',
                columns: 'icon-select',
                export: 'icon-export'
            },
            responseHandler: function (res) {
                $("#dsh").html(res.length);
                return res;
            },
            formatNoMatches: function () { //判断有无数据
                var imghtml = '<div class="flexed_column content_center content_alignCenter padding-20"><img src="https://static.9hive.cn/global/img/nodata.png" class="no_data"/><span class="font-size-16">暂无数据</span></div>';
                return imghtml;
            },
            formatLoadingMessage: function () {  //数据加载中样式
                return ' <div id="loading"><div id="loading-center">' +
                    '<div id="loading-center-absolute"><div class="object" id="object_one">' +
                    '</div><div class="object" id="object_two"></div><div class="object" id="object_three">' +
                    '</div><div class="object" id="object_four"></div></div></div>努力加载中...</div>'
            },
        });

        $('#export').on('click', function (e) {
            location.href = 'export?type=now';
        });

        $(".wrapper").tooltip({selector: "[data-toggle=tooltip]", container: "body"});

    })();
</script>
</body>
</html>